import request from '@/utils/request.js'
// import store from '@/store'

/**
 *
 * @param {*} mobile 手机号
 * @returns promise
 */
export const sendCodeAPI = mobile => {
  return request({
    url: '/v1_0/sms/codes/' + mobile
  })
}

/**
 *
 * @param {*} data 手机号和验证码
 * @returns promise
 */
export const loginAPI = data => {
  return request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data
  })
}

/**
 * 获取用户信息的方法
 * @returns promise
 */
export const getUserInfoAPI = () => {
  return request({
    url: '/v1_0/user'
    // headers: {
    //   Authorization: 'Bearer ' + store.state.user.token
    // }
  })
}

// 封装请求用户频道的方法
export const getUserChannelAPI = () => {
  return request({
    url: '/v1_0/user/channels'
    // headers: {
    //   Authorization: 'Bearer ' + store.state.user.token
    // }
  })
}
